package com.ruoyi.wm.utils;

import com.ruoyi.wm.domain.WmStatistics;
import com.ruoyi.wm.service.IWmStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Calendar;

@Component
public class timeTask {
    @Autowired
    private IWmStatisticsService wmStatisticsService;
    @Scheduled(cron = "0 0 0 1 * ?")
    public void addInfo(){
        wmStatisticsService.insertWmStatisticsEveryMonth();//每月的零点执行程序
    }

    @Scheduled(cron ="0 0 10 28-31 * ?")
    public void InventoryPerMonth(){
        final Calendar c = Calendar.getInstance();
        if (c.get(Calendar.DATE) == c.getActualMaximum(Calendar.DATE)) {    //当月最后一天
            //定时任务逻辑
        }
    }
}
